package com.example.administrator.ddmsactivitylifecycle;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.view.menu.MenuAdapter;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    static final String LIFT_TAG="LogActivity";//声明一个字符串常量

    private Button myButton;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       Log.v(MainActivity.LIFT_TAG,"FirstActivity ---> onCreate");
        Button myButton = (Button)findViewById(R.id.myBotton);
        myButton.setText("启动第二个Activity");
        myButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(MainActivity.this,LogActivity2.class);
                MainActivity.this.startActivity(intent);

                }
            }
        });

    }
}
